import Vue from "vue";
import Vuex from 'vuex'
Vue.use(Vuex)

const store=new Vuex.Store({
    state:{
        routes:[]//存放全局数据
    },
    mutations:{//存放同步方法,修改state中的值
        setRoutes(state,routes){
            state.routes=routes
        }
    },
    actions:{
        setRoutesAsync(context,routes){
            context.commit("setRoutes",routes)
        }
    },
    getters:{
        getRoutes(state){
             return state.routes
        }
    }
})
export default store